package com.chixing.day13_list;

public class Student {
    private String stuName;
    private int stuAge;

    public Student(String stuName, int stuAge) {
        this.stuName = stuName;
        this.stuAge = stuAge;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Student student = (Student) o;

        if (stuAge != student.stuAge) return false;
        return stuName != null ? stuName.equals(student.stuName) : student.stuName == null;
    }

    @Override
    public int hashCode() {
        int result = stuName != null ? stuName.hashCode() : 0;
        result = 31 * result + stuAge;
        return result;
    }

    public String getStuName() {
        return stuName;
    }

    public void setStuName(String stuName) {
        this.stuName = stuName;
    }

    public int getStuAge() {
        return stuAge;
    }

    public void setStuAge(int stuAge) {
        this.stuAge = stuAge;
    }

    @Override
    public String toString() {
        return "Student{" +
                "stuName='" + stuName + '\'' +
                ", stuAge=" + stuAge +
                '}';
    }
}
